package com.zzptc.zzsgz.bdsjws.fragments;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zzptc.zzsgz.bdsjws.MyApplication;
import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.adapter.ContactAdapter;
import com.zzptc.zzsgz.bdsjws.fragments.base.BaseFragmentbase;
import com.zzptc.zzsgz.bdsjws.utils.MyUtil;
import com.zzptc.zzsgz.bdsjws.vo.Contact;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by zzsgz on 2017/6/5.
 */

public class ShowAllContactFragment extends BaseFragmentbase {
    @BindView(R.id.rv_show_contact)
    RecyclerView rvShowContact;
    List<Contact> list=null;

    @Override
    public int getXML() {
        return R.layout.show_all_contact_fragment;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

//        //得到数据
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                list= MyUtil.getAllContacts();
//            }
//        }).start();
//
        list= MyApplication.getList();
        //写适配器类
       if(list.size()!=0) {
           ContactAdapter contactAdapter = new ContactAdapter(list);

        //布局管理者
        rvShowContact.setLayoutManager(new LinearLayoutManager(getActivity()));
        rvShowContact.setAdapter(contactAdapter);
       }



    }

}
